package com.dlwx.parttimetalent.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.dlwx.parttimetalent.R;
import com.dlwx.parttimetalent.bean.MySelfInfoBean;
import com.dlwx.parttimetalent.inter.PositionInter;

/**
 * Created by Administrator on 2017/11/21.
 */

public class VideoAdapter extends ListBaseAdapter<MySelfInfoBean.BodyBean.ViedoBean> {
    private  Context context;
    private PositionInter inter;
    public VideoAdapter(Context context,PositionInter inter) {
        super(context);
        this.context=context;
        this.inter=inter;
    }

    @Override
    public int getLayoutId() {
        return R.layout.item_photo;
    }

    @Override
    public void onBindItemHolder(SuperViewHolder holder, final int position) {
        MySelfInfoBean.BodyBean.ViedoBean bean = getDataList().get(position);
        ImageView imageDelete = holder.getView(R.id.image_delete);
        ImageView imageView = holder.getView(R.id.image);
//        Glide.with(context).load(bean.getCover()).into(imageView);

        if(TextUtils.isEmpty(bean.getCover())){
            imageDelete.setVisibility(View.GONE);
            Glide.with(context).load(R.mipmap.icon_shangchuanshipin).into(imageView);
        }else{
            imageDelete.setVisibility(View.VISIBLE);
            Glide.with(context).load(bean.getCover()).into(imageView);
        }
        imageDelete.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                inter.callBack(position);
            }
        });
    }
}
